//
// Created by francklinson on 2021/10/23 AT 12:23.
//
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
#include <functional>
#include <climits>
#include <string>
#include "../myTool.h"

//using namespace std;
struct Vector2 {
    float x, y;
};
struct Vector4 {
    union {
        // 对于同一块内存的不同解释方法
        // 等价的
        struct {
            float x, y, z, w;
        };
        struct {
            Vector2 a, b;
        };
    };
};

void PrintVector2(const Vector2 &vector) {
    std::cout << vector.x << ", " << vector.y << std::endl;
}

int main() {
    Vector4 v = {1.0f, 2.0f, 3.0f, 4.0f};
    PrintVector2(v.a);
    PrintVector2(v.b);
    std::cout << "---------------------" << std::endl;
    v.z = 500;
    PrintVector2(v.a);
    PrintVector2(v.b);
    return 0;
}

